<template>
<span :class="wrapper_name">
    <button v-if="col.btns.QRCODE" class="ui button primary mini " @click.stop.prevent="qrcode(col.val)" :title="col.btns.QRCODE">
      {{col.btns.QRCODE}}
    </button>
</span>
</template>
<script type="text/ecmascript-6">
import tool from 'src/util/tool';
import util from '_util/index';

export default {
    data() {
        return {}
    },
    methods: {
        qrcode(id) {
			let _this = this;
			util.http.getDataCom(this, '/index/Qd/read', {
				id
			},(rs) => {
				let detail = [[
					{name:'chat_product',label:'会话商品',value:''},
					{name:'hotel_name',label:'场景',value:''},
					{name:'server_names',label:'服务者',value:''},
					{name:'scode',label:'渠道码',value:''},
					{name:'name',label:'渠道用户',value:''},
					{name:'qrcode_url',label:'二维码',value:''}
			]];
			detail[0].forEach(item=>{
				if(item.name=='qrcode_url'){
					item.value = `<img src='${rs[item.name]}'>`
				}else{
					item.value = rs[item.name]
				}
			})

				this.$store.state.global.eventVue.$emit('showPopCom', {
					_this: this,
					id: id,
					data: {
						title:'二维码信息',
						columnNum:'one',
						detail:detail,
					},
					name: 'detailList'
				});
			})
        },
    },
    computed: {
        ctl() {
            return this.$route.query.ctl;
        },
        is_admin() {
            return util.is_admin(this);
        }
    },
    watch: {},

    props: ['col', '_id', 'detail_info', 'wrapper_name'],
    created() {

	},
}
</script>
<style rel="stylesheet/less" lang="less"></style>
